<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file license.txt or that can be found at 
 * http://code.google.com/p/billboardce/wiki/License.
 *
 * @package    Ot_Action_Helper_Log
 * @category   Library
 * @license    http://code.google.com/p/billboardce/wiki/License New BSD License
 * @version    SVN: $Id: $
 */

/**
 * Adds ability to log from the actions
 *
 * @package    Ot_Action_Helper_Log
 * @category   Library
 */
class Ot_Action_Helper_Log extends Zend_Controller_Action_Helper_Abstract
{
	protected $_logger;
	
	public function init()
	{
		$this->_logger = Zend_Registry::get('logger');
		
		parent::init();
	}
	
    public function log($priority, $action, $options = array())
    {
		foreach ($options as $key => $value) {
			$this->_logger->setEventItem($key, $value);
		}
		
		$this->_logger->log($action, $priority);
    }
    
    public function direct($priority, $action, $options = array())
    {
        return $this->log($priority, $action, $options);
    }
}